package helpers;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import data.AutoSiteData;
import data.BlogData;
import models.AutoSite;
import models.Blog;

public class ExampleHelper {
	
	/*private static String blogId = "6686548263735304639"; //4127138814178186998
	
	private static String blogName = "1st review app"; //Blogger
	
	private static String username = "hoanbn.1streview@gmail.com"; //hoanbn.y1s@gmail.com
	
	private static String password = "0983767270"; //0983767270
*/	
	private static String blogId = "4127138814178186998"; //4127138814178186998
	
	private static String blogName = "Blogger"; //Blogger
	
	private static String username = "hoanbn.y1s@gmail.com"; //hoanbn.y1s@gmail.com
	
	private static String password = "0983767270"; //0983767270
	
	private static ArrayList<String> appstormCategoryKeys = new ArrayList<String>(Arrays.asList(
			"business-finance", "food-drink-reviews", "games-reviews", "graphics", "internet-reviews",
			"lifestyle", "music", "office-reviews", "productivity", "security", "utilities"));
	
	private static ArrayList<String> appstormCategoryNames = new ArrayList<String>(Arrays.asList(
			"business finance", "food drink", "games", "graphics", "internet",
			"lifestyle", "music", "office", "productivity", "security", "utilities"));
	
	public static Blog insertBlog() {
		Blog blog = new Blog();
		blog.setBlogId(blogId);
		blog.setBlogName(blogName);
		blog.setUsername(username);
		blog.setPassword(password);
		List<String> categories = new ArrayList<String>();
		categories.add("Apps review");
		categories.add("Games review");
		blog.setCategories(categories);
		return blog;
	}
	
	public static AutoSite insertAutoSiteToucharcade() {
		AutoSite autoSite = new AutoSite();
		autoSite.setSite("http://toucharcade.com/category/reviews/");
		autoSite.setRegLink("#content .post h3 a");
		autoSite.setRegTitle("#content .post h2 a");
		autoSite.setRegDescription("#content .post .entry");
		autoSite.setCategory("Games review");
		autoSite.setBlogId(blogId);
		autoSite.setId(autoSite.createId(autoSite.getBlogId(), autoSite.getSite()));
		autoSite.setCurrentPage(1);
		autoSite.setSitePage("http://toucharcade.com/category/reviews/page/");
		autoSite.setScheduleSite(60*12);
		autoSite.setScheduleSitePage(60*24);
		return autoSite;
	}
	
	public static ArrayList<AutoSite> insertIphoneAppstorm() {
		ArrayList<AutoSite> list = new ArrayList<AutoSite>();
		
		AutoSite autoSite = new AutoSite();
		for (int i = 0; i < appstormCategoryKeys.size(); i++) {
			autoSite = new AutoSite();
			autoSite.setSite("http://iphone.appstorm.net/category/reviews/" + appstormCategoryKeys.get(i) + "/");
			autoSite.setRegLink("#page .postmetadata h1 a");
			autoSite.setRegTitle("#page .postmetadata h1");
			autoSite.setRegDescription("#page .post .entry");
			autoSite.setRegRemove("#page .post .entry script");
			autoSite.setCategory(appstormCategoryNames.get(i));
			autoSite.setBlogId(blogId);
			autoSite.setId(autoSite.createId(autoSite.getBlogId(), autoSite.getSite()));
			autoSite.setCurrentPage(1);
			autoSite.setSitePage("http://iphone.appstorm.net/category/reviews/" + appstormCategoryKeys.get(i) + "/page/");
			autoSite.setScheduleSite(60*18);
			autoSite.setScheduleSitePage(60*24);
			list.add(autoSite);
		}
		return list;
	}
}
